<?php
class KanbaobiaoAction extends BaseAction {
 

	function index() {
	
		$this->display();
		}
		function getmall_order()
	{  
	      /*'商城名称', name: 'mallname', 
		?'收益比例', name: 'sybl', 
        '购物金额', name: 'sales'
	    '总收益', name: 'commission', 
        '购物收益', name: 'gusy', 
		'业务收益', name: 'ywsy', 
		'分红收益', name: 'fhsy', 
		'商城人气', name: 'scrq', 
	    '商城标志', name: 'mallimg',
		'去购物赚收益', name: 'mallurl',
	    '业务链接', name: 'ywurl',
	  */
	 
	  $table1=array();
	  $j=0;
	  foreach($this->getdbleveldata($_POST['id']) as $ke => $val){
	    $val1=$this->object2array($val);
	      $table1[$j]['mallname']=$val1['name'];
		  $table1[$j]['sybl']=0.7;
		  $table1[$j]['sales']=round($this->mall_order->field('sales')->where("adid='".$ke."'")->sum('sales')+300000+rand(1,10000)+$this->randomFloat(0,1),2);
		  $table1[$j]['commission']=round($this->mall_order->field('commission')->where("adid='".$ke."'")->sum('commission')+300000*0.1+$this->randomFloat(0,1),2);
	      $table1[$j]['gusy']=round($table1[$j]['commission']*0.2,2);
		  $table1[$j]['ywsy']=round($table1[$j]['commission']*0.3,2);
		  $table1[$j]['fhsy']=round($table1[$j]['commission']*0.1,2);
		  $table1[$j]['scrq']=$this->mall_order->field('id')->where("adid='".$ke."'")->Count('id')+50000+rand(1,10000);
		   $table1[$j]['mallimg']="<img src='".$val1['img']."'/>";
	      $table1[$j]['mallurl']="<a href='".$val1['url'].$this->uid."'>去购物</a>";
		  $table1[$j]['ywurl']=$val1['url'].'y'.$this->uid;
		  $j++;
		 } 
		 $data="{Rows:".json_encode($table1).",Total:".count($table1)."}";
		
	     $this->ajaxReturn($data,"","");
	  /*
	  $tj= array();
	  $tj['sales']=$this->mall_order->field('sales')->where("mall_name='".$_POST['name']."'")->sum('sales');
	  $tj['commission']=$this->mall_order->field('commission')->where("mall_name='".$_POST['name']."'")->sum('commission');
	  $tj['fxje']=$this->mall_order->field('fxje')->where("mall_name='".$_POST['name']."'")->sum('fxje');
      $table1=$this->mall_order->query("SELECT order_time,sales , commission, fxje,(commission-fxje) as fuwufei FROM  __TABLE__ WHERE mall_name='".$_POST['name']."'");
		foreach($table1 as $k => $v)
		{
		  $table1[$k]['order_time']=date("Y-m-d",$v['order_time']);
		}
		 $data="{Rows:".json_encode($table1).",Total:".count($table1)."}";
	     $this->ajaxReturn($data,$tj,"");
	 */
	 
	}
 
}